import java.util.Scanner;
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String password = "123456"; // 正确的密码
        int count = 0; // 输入密码的次数
        while (count < 3) {
            System.out.print("请输入密码：");
            String input = scanner.nextLine();
            if (input.equals(password)) {
                System.out.println("登录成功！");
                break;
            } else {
                count++;
                if (count < 3) {
                    System.out.println("密码错误，请重新输入！");
                } else {
                    System.out.println("密码错误，退出程序！");
                }
            }
        }
    }
    public static void main7(String[] args) {
        //模拟登陆
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        String password = "1234";
        int count = 3;
        while(count>0){
            if(input == password){
                System.out.println("恭喜你，登陆成功！");
                break;
            }
            if(input != password){
                System.out.println("您的密码输入错误，请重新输入！");
                count--;
                //System.out.println("您还有"+count+"次机会!");

            }

        }
    }
    public static void main6(String[] args) {
        //求出整数的每一位
        Scanner scanner = new Scanner(System.in);
        int sc = scanner.nextInt();
        while(sc!=0){
            System.out.println(sc%10);
            sc/=10;
        }
    }
    public static void main5(String[] args) {
        //打印乘法口诀
        int i;
        int j;
        for(i=1;i<=9;i++){
            for(j=1;j<=i;j++){
                System.out.print(j+"*"+i+"="+i*j+"     ");
            }
            System.out.println();
        }
    }
    public static void main4(String[] args) {
        //1-100之间有多少个数字9
        int i;
        int count = 0;
        for(i=1;i<=100;i++){
            if(i%10==9){//判断个位的9
                count++;
            }
            if(i/10==9){//判断十位的9
                count++;
            }
        }
        System.out.println(count);
    }
    public static void main3(String[] args) {
        //打印1000-2000之间的闰年
        int i;
        for(i=1000;i<=2000;i++){
            if((i%4==0)&&(i%100!=0)){
                System.out.println(i+"是普通闰年！");
            }
            else if(i%400==0){
                System.out.println(i+"是世纪闰年！");
            }
        }

    }
    public static void main2(String[] args) {
        //打印1-100之间的所有素数
        int i = 1;
        for(i=1;i<=100;i++){
            int j ;
            for(j=2;j<i;j++){
                if(i%j==0){
                    //System.out.println(i+"不是素数！");
                    break;
                }
            }
            if(j>=i){
                System.out.println(i);
            }
        }
    }



    public static void main1(String[] args) {
        //判断一个数是不是素数
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int i = 0;
        for(i=2;i<n;i++){
            if(n%i==0) {
                System.out.print(n + "不是素数！");
                break;
            }
        }
        if(i>=n){
            System.out.println(n+"是素数！");

        }
    }
}

